{%include file="index.header.tpl.php"%}
{%include file="index.left.tpl.php"%}
  <!--主要内容开始-->
  <div class="content-wrapper">
    <section class="content">
      <div class="row">
        <!--树状图-->
        <section class="col-lg-2 connectedSortable" style="padding-right:0;">
         <div class="sidebar" style="background-color:#fff; padding-bottom:0px;">
             <ul class="sidebar-menu" id="chan">
					{%foreach from=$class_lists key=key item=value%}
                    <li class="treeview {%if $key==$class_data.grade_id%}active{%/if%}" >
                      <a href="#">
                        <i class="glyphicon glyphicon-align-left"></i> <span>{%$value.grade_name%}</span> <i class="fa fa-angle-left pull-right"></i>
                      </a>
                          <ul class="treeview-menu" style="background-color:#fff;">
							{%foreach from=$value.class key=k item=v%}
                            <li {%if $v.class_id==$class_data.class_id%}class="active"{%/if%}><a href="index.php?a=score.range&class_id={%$v.class_id%}"><i class="fa fa-angle-right"></i>  {%$v.class_name%}</a></li>
							{%/foreach%}
                          </ul>
                     </li>
					{%/foreach%}
              </ul>
            </div>
          
        </section>
        <!--树状图结束-->
        <section class="col-lg-10 connectedSortable">
         <div class="box box-default box-solid">
             <form action="" method="post">	
                <div class="box-header with-border">
                    <span class="fa fa-edit (alias)" style="float:left; font-size:18px; padding-top:3px; color:#3c8dbc;" ></span>
                    <p class="box-title">{%$class_data.class_name%}成绩统计分数段设置</p>
                </div>
                <div class="box-body">
                      <div class="form-group">
						  <label class="col-md-1 control-label" style="padding:0; width:110px;">
							   考试分类：
						  </label>
						  <div class="input-group col-md-3 col-sm-12 col-xs-12">
							    {%$range_data.exam_type%}
						   </div> 
				      </div>
                      <div class="form-group tea">
						  <label class="col-md-1 control-label"  style="padding:0; width:110px;">
							   考试名称：
						  </label>
						  <div class="input-group col-md-10 col-sm-10 col-xs-12">
							    {%$range_data.exam_name%}
						   </div> 
				      </div>

                      <div class="form-group">
						  <label class="col-md-1 control-label"  style="padding:0; width:110px;">
							   学科：
						  </label>
						  <div class="input-group col-sm-10 col-xs-12">
							    {%$range_data.score_subject%}
						   </div> 
				      </div>
                      <div class="form-group">
						  <label class="col-md-12 control-label"  style="padding:0">
							   分阶设置：<span class="text-info">分阶是用于统计报表中各分数段的人数，注意分阶不要有缺漏或交叉</span>
						  </label>
						  <div class="col-md-5  col-sm-offset-1  col-sm-5 col-xs-12">
							    <table class="table" id="plus" style="width:380px;">
                                       <tr>
                                            <td>操作</td>
                                            <td>分阶</td>
                                            <td>最高分</td>
                                            <td>最低分</td>
                                       </tr>
									   {%foreach from=$range_data.range_level key=key item=value%}
                                       <tr>
                                            <td><input type='checkbox' name='chkArr{%$key%}' id='chkArr{%$key%}' style='width:20px' /></td>
                                            <td><input type='text' name='level_name{%$key%}' id='nodecode{%$key%}' style='width:50px' value='{%$value.name%}'/></td>
                                            <td><input type='text' name='level_max{%$key%}' id='nodename{%$key%}' style='width:80px' value='{%$value.max%}'/></td>
                                            <td><input type='text' name='level_min{%$key%}' id='nodeper{%$key%}' style='width:80px' value='{%$value.min%}'/></td>
										</tr>	
										{%/foreach%}
                                </table>
                                <input type="button" name="xx" onclick="addNewRow();" value="添加分阶" />
                                <input type="button" name="yy" onclick="removeRow();" value="删除分阶" />
						   </div>
                           <div class="col-md-5 col-sm-5 col-xs-12" style="padding-top:40px; margin-left:20px;">
							            <label class="choice">满分：<input type="text" size="10" name="range_full" value="{%$range_data.range_full%}"></label>
                                       <label class="choice"><input type="radio" name="range_fullopen" value="1" {%if $range_data.range_fullopen=='1'%}checked{%/if%}> 启用</label>
                                       <label class="choice"><input type="radio" name="range_fullopen" value="0" {%if $range_data.range_fullopen=='0'%}checked{%/if%}> 不启用</label>
						   </div>  
				      </div>
                      <div style="clear:both; height:30px;"></div>
                      <div class="form-group">
						  <label class="col-md-12 control-label"  style="padding:0">
							   优良率分数段设置：<span class="text-info">优良率分数段用于统计报表中的各分数层人数及占比</span>
						  </label>
						  <div class="col-md-10 col-sm-offset-1  col-sm-5 col-xs-12">
							    <table class="table">
									{%foreach from=$range_data.range_section key=key item=value%}
                                       <tr>
                                            <td style="width:110px;">{%$score_section_ini.$key%}分数段</td>
                                            <td><input type="text" size="10" name="sectionmin_{%$key%}" value="{%$value.min%}"></td>
                                            <td>-</td>
                                            <td><input type="text" size="10" name="sectionmax_{%$key%}" value="{%$value.max%}"></td>
                                            <td style="width:90px;"><label><input type="radio" name="sectionopen_{%$key%}" value="1" {%if $value.open=='1'%}checked{%/if%}> 启用</label></td>
                                            <td><label><input type="radio" name="sectionopen_{%$key%}" value="0" {%if $value.open=='0'%}checked{%/if%}> 不启用</label></td>
                                       </tr>
									{%/foreach%}
                                </table>
						   </div>
				      </div>

                    
				</div><!--box-body -->
						<div id="hiddenBox"></div>
                <div class="box-footer text-center">
                    <button type="submit" class="btn btn-primary " >  确 定</button>
                </div>
              </form>
           </div><!--box box-default box-solid-->
         </section>   
        </div><!--row-->
    </section>
 </div>
  <!--主要内容结束-->
{%include file="index.footer.tpl.php"%}

    <script language="javascript">
 //窗口表格增加一行
  function addNewRow(){
   var tabObj=document.getElementById("plus");//获取添加数据的表格
   var rowsNum = tabObj.rows.length;  //获取当前行数
   var colsNum=tabObj.rows[rowsNum-1].cells.length;//获取行的列数
   var myNewRow = tabObj.insertRow(rowsNum);//插入新行
   var newTdObj1=myNewRow.insertCell(0);
   newTdObj1.innerHTML="<input type='checkbox' name='chkArr' id='chkArr"+rowsNum+"' style='width:20px' />";
   var newTdObj2=myNewRow.insertCell(1);
   newTdObj2.innerHTML="<input type='text' name='level_name"+rowsNum+"' id='nodecode"+rowsNum+"' style='width:50px' value='分阶"+rowsNum+"'/>";
   var newTdObj3=myNewRow.insertCell(2);
   newTdObj3.innerHTML="<input type='text' name='level_max"+rowsNum+"' id='nodename"+rowsNum+"' style='width:80px' />";
   var newTdObj4=myNewRow.insertCell(3);
   newTdObj4.innerHTML="<input type='text' name='level_min"+rowsNum+"' id='nodeper"+rowsNum+"' style='width:80px' />";
  }
//窗口表格删除一行
  function removeRow(){
   var chkObj=document.getElementsByName("chkArr");
   var tabObj=document.getElementById("plus");
   for(var k=0;k<chkObj.length;k++){
    if(chkObj[k].checked){
     tabObj.deleteRow(k+1);
     k=-1;
    }
   }
  }
</script>


